/* 540. 有序数组中的单一元素 */
/**
 * @param {number[]} nums
 * @return {number}
 */
/* 确保中间项是偶数，比较下一项 */
var singleNonDuplicate = function (nums) {
    let len = nums.length
    if (len === 1) return nums[0]
    let left = 0, right = len - 1
    while (left < right) {
        let mid = left + Math.floor((right - left) / 2)
        mid -= mid & 1
        if (nums[mid] === nums[mid + 1]) {
            left = mid + 2
        } else {
            right = mid
        }
    }
    return nums[left]
};
singleNonDuplicate([3, 3, 7, 7, 10, 11, 11])